package com.gxa.logistics.controller;

import com.gxa.logistics.domain.dto.TransferrecordDTO;
import com.gxa.logistics.domain.dto.WarehouseDTO;
import com.gxa.logistics.domain.vo.WarehouseVO;
import com.gxa.logistics.service.impl.TransferrecordServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@Api(tags = "库存管理-转移记录")
@RequestMapping("/transferrecord")
public class TransferrecordController {

    @Resource
    private TransferrecordServiceImpl transferrecordService;

    @PostMapping("/insert") //插入数据
    public Map<String, Object> insert(@RequestBody TransferrecordDTO transferrecordDTO) {
        return transferrecordService.insert(transferrecordDTO);
    }
    @PostMapping("/delete") //删除数据
    public Map<String, Object> delete(@RequestParam Integer transferrecord_id) {
        return transferrecordService.delete(transferrecord_id);
    }
    @PostMapping("/update") //修改
    public Map<String, Object> update(@RequestBody TransferrecordDTO transferrecordDTO) {
        return transferrecordService.update(transferrecordDTO);
    }

    @GetMapping("/selectTransferrecordByMaterialName") //按物料名字查询
    public Map<String, Object> selectTransferrecordByMaterialName(@RequestParam String material_name) {
        return transferrecordService.selectTransferrecordByMaterialName(material_name);
    }


    @GetMapping("/selectTransferrecord") //浏览与分页
    public Map<String, Object> selectTransferrecord(@RequestParam int page, @RequestParam int limit) {
        return transferrecordService.selectTransferrecord(page, limit);
    }
}
